<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <div>
    <select id="fromSel">
      <option value="1">中文</option>
      <option value="2">日文</option>
      <option value="3">英文</option>
      <option value="4">韩文</option>
    </select>
    <select id="toSel">
      <option value="1">中文</option>
      <option value="2">日文</option>
      <option value="3">英文</option>
      <option value="4">韩文</option>
    </select>
    <button id="btn">翻译</button>
  </div>
  <div>
    <textarea name="" id="myq" cols="30" rows="10"></textarea>
    <br>
    <div>
      <div class="myTran"></div>
      <div class="list">
        <span></span> <span></span><span></span>
      </div>
    </div>
  </div>
  <script src="./jquery-3.4.1.min.js"></script>
  <script>
    $("#btn").click(function () {
      $.ajax({
        url: "https://route.showapi.com/32-9",
        type: "post",
        data: {
          showapi_appid: "470293",
          showapi_sign: "2533f62071a94571aefd5051c73fc9b7",
          q: $("#myq").val(),
          fromLanguage: $("#fromSel").val(),
          toLanguage: $("#toSel").val()
        },
        success: function (res) {
          console.log(res)
          $(".myTran").html($("#myq").val())
          var data = res.showapi_res_body.translation;
          var str = ''
          $.each(data, function (index, ele) {
            str += `<span>${ele}</span>`
          })
          $(".list").html(str);
        }
      })

    })

  </script>
</body>

</html>